﻿#ifndef DEVICEINFOMANAGER_H
#define DEVICEINFOMANAGER_H

#include <qobject.h>
#include <qvector.h>
#include <qhash.h>
#include <qtimer.h>
#include "ObjAutoInject.h"


class Device;
class UserInfoCodec;
class DeviceInfoManager : public QObject,public ObjAutoInject
{
  Q_OBJECT
private://property
  QTimer timer_updateDeviceInfoList;
  QVector<Device> deviceInfoList;
  QHash<uint/*deviceId*/,uint/*index*/> deviceInfoListIndex;
private://dependency
  UserInfoCodec* userInfoCodec=Q_NULLPTR;
public:
  explicit DeviceInfoManager();
  virtual ~DeviceInfoManager();
signals:
  void signal_newAllDeviceInfo();
public:
  bool contains(uint deviceId);
  Device *getDeviceInfoByDeviceId(uint deviceId);
  void startTimer_allDevice(int msec);
  void stopTimer_allDevice();
public://geter and seter
  QVector<Device>* getDeviceInfoList();
  DeviceInfoManager* setDeviceInfoList(QVector<Device>* const deviceInfoList);
  UserInfoCodec* getUserInfoCodec()const;
  DeviceInfoManager* setUserInfoCodec(UserInfoCodec*const userInfoCodec);
public:
  virtual void objectAutoInjection(QHash<QString,QObject*>* objMap);
};

#endif // DEVICEINFOMANAGER_H
